package com.example.analyzevisio.utis;

import com.example.analyzevisio.model.Shape;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class VSDXToJson {
    public static void convertToJSON(List<Shape> shapes, String outputPath) {
        ObjectMapper objectMapper = new ObjectMapper();
        Map<String, Object> jsonMap = new HashMap<>();
        jsonMap.put("shapes", shapes);

        try (FileWriter file = new FileWriter(outputPath)) {
            objectMapper.writerWithDefaultPrettyPrinter().writeValue(file, jsonMap);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

  /*  public static void main(String[] args) throws Exception {
//         VSDXParser.parsePageXml("C:\\Users\\ms206\\Desktop\\visio图\\绘图1\\visio\\pages\\Page1.xml");
//        convertToJSON(shapes, "output.json");
    }*/
}
